<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="description" content="loginPage">
	<title>铁路接近告警系统</title>
	<link rel="stylesheet" type="text/css" href="../static/easyui/themes/bootstrap/easyui.css">
	<link rel="stylesheet" type="text/css" href="../static/css/login.css" />
	<link rel="shortcut icon" href="../static/img/logo_32.ico" type="image/x-icon">
	<script type="text/javascript" src="../static/easyui/jquery.min.js"></script>
	<script type="text/javascript" src="../static/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../static/js/login.js"></script>
</head>

<body oncontextmenu="return false">
	<div id="page">
		<div id="title">
			<img src="../static/img/title_tj.png" alt="系统名称" class="titleImg" />
		</div>
		<!--  <div id="center"> -->
		<div id="home">
			<img src="../static/img/cars_user.png" id="car" alt="车插图" />

			<div id="info" method="POST" action="/login">
				{{.Success}}
				<h3>用户登录</h3>
				<label class="user">登录ID
					<input id="userID" class="easyui-validatebox" data-options="required:true,validType:'loginId',missingMessage:'登录ID不能为空'"
					/>
					<span id="idMsg">登录ID为空</span>
				</label>
				<label class="user">密　码
					<input id="userPwd" class="easyui-validatebox" type="password" data-options="validType:'loginPwd'" />
					<span id="pwdMsg">密码为空</span>
				</label>
				
				<label class="another">验证码
					<input type="text" name="captcha" />
					<!-- <span id="codeMsg">验证码为空</span> -->
				</label>
				{{create_captcha}}
				<!-- 　　　　<input type="submit" value="提交" /> -->
				<!-- <span style="font-size:14px;color:#04a;">记录登陆状态</span> -->
				<button type="submit" id="btn" value="提交">登录</button>
			</div>
		</div>
		<!-- </div> -->
		<div id="copyright">Copyright©
			<span id="currentyear"></span>&nbsp;天津七一二通信广播股份有限公司&nbsp;&nbsp;联系电话：022-65388216&nbsp;&nbsp;</div>
	</div>
	<script type="text/javascript">
		document.onkeydown = function (e) {
			var theEvent = window.event || e;
			var code = theEvent.keyCode || theEvent.which;
			if (code == 13) {
				$("#btn").click();
			}
		};

		//设置版权所有时间为当前年份
		var currentdate = new Date();
		var currentyear = currentdate.getFullYear();
		document.getElementById("currentyear").innerHTML = currentyear;

		$("#btn").click(function () {
			console.log("click");
			$.ajax({
				url: "/login",
				type: "post",
				dataType: "json",
				data: {
					"op":"login",
					"uname": $("#userID").val(),
					"upass": $("#userPwd").val(),
					"captcha_id": $("input[name='captcha_id']").attr("value"),
					"captcha": $("input[name='captcha']").val(),
				},
				success: function (json) {
					console.log(json)
					window.location.href = '/';
				}

			})

		})
	</script>
</body>

</html>